// 此文件为路由配置文件

import { createAppContainer } from 'react-navigation';
import { createReactNavigationReduxMiddleware, createReduxContainer } from 'react-navigation-redux-helpers';
import { createStackNavigator } from 'react-navigation-stack';
import { connect } from 'react-redux';

import Home from '../pages/Home/Home';
import MoreMovies from '../pages/Home/MoreMovies';
import RankingList from '../pages/Home/RankingList';
import SearchPage from '../pages/Home/SearchPage';
import SearchResult from '../pages/Home/SearchResult';

import Classify from '../pages/Classify/Classify';
import History from '../pages/History/History';
import Want from '../pages/History/Want';   //想追动漫页面
import Mine from '../pages/Mine/Mine';
import MainTab from './MainTab'
// 三个登陆页面
import Login from '../pages/Mine/Login/Login';
import Register from '../pages/Mine/Login/Register'
import Login_phone from '../pages/Mine/Login/Login_phone';
// 9个设置
import Cachemanagement from '../pages/Mine/Seting/Cachemanagement';
import Historyseting from '../pages/Mine/Seting/History_seting';
import Feedback from '../pages/Mine/Seting/Feedback'
import Messagenotification from '../pages/Mine/Seting/Messagenotification';
import Mycollection from '../pages/Mine/Seting/Mycollection';
import Editordelete from '../pages/Mine/Seting/Editor_delete'   //编辑删除
import Offlinecaching from '../pages/Mine/Seting/Offlinecaching';
import Praise from '../pages/Mine/Seting/Praise';
import Seting from '../pages/Mine/Seting/Seting';
import Shareapps from '../pages/Mine/Seting/Shareapps';
import Weibo_Login from '../pages/Mine/Login/Weibo_Login';
import Weixin_Login from '../pages/Mine/Login/Weixin_Login';
import Detail from '../pages/Detail/Detail';
import Demo from '../pages/VideoPlay/VideoDemo';

// import VideoPlay from '../pages/VideoPlay/VideoPlay';
// import Barrage from '../pages/Barrage/Barrage';
// import ShareButton from '../pages/More/ShareButton';
// import TestCustomAlert from '../pages/More/TestCustomAlert';
// import PlaySpeed from '../pages/More/PlaySpeed';
// import ChooseAShow from '../pages/More/ChooseAShow';
// import DownloadProgress from '../pages/More/DownloadProgress'
// import xuanji from '../pages/More/xuanji'

const MainNavigation = createStackNavigator({
    // tab1：首页
    Home: {
        screen: Home,
        navigationOptions: {
            headerShown: false
        }
    },
    // MoreMovies
    MoreMovies: {
        screen: MoreMovies,
        navigationOptions: {
            headerShown: false
        }
    },
    // RankingList
    RankingList: {
        screen: RankingList,
        navigationOptions: {
            headerShown: false
        }
    },
    // 详情页
    Detail:{
        screen: Detail,
        navigationOptions: {
            headerShown: false
        }
    },

    //搜索页
    SearchPage: {
        screen: SearchPage,
        navigationOptions: {
            headerShown: false
        }
    },
    // 搜索结果页面
    SearchResult: {
        screen: SearchResult,
        navigationOptions: {
            headerShown: false
        }
    },
    
    // tab2：分类页
    Classify: {
        screen: Classify,
        navigationOptions: {
            headerShown: false
        }
    },
    // tab3：追剧历史
    History: {
        screen: History,
        navigationOptions: {
            headerShown: false
        }
    },
    //想追动漫页面
    Want: {
        screen: Want,
        navigationOptions: {
            headerShown: false
        }
    },
    // tab4：我的
    Mine: {
        screen: Mine,
        navigationOptions: {
            headerShown: false
        }
    },
    MainTab: {
        screen: MainTab,
        navigationOptions: {
            headerShown: false
        }
    },
    // 三个登陆页面
    Login: {
        screen: Login,
        navigationOptions: {
            headerShown: false
        }
    },
    Register: {
        screen: Register,
        navigationOptions: {
            headerShown: false
        }
    },
    Login_phone: {
        screen: Login_phone,
        navigationOptions: {
            headerShown: false
        }
    },
    Weibo_Login: {
        screen: Weibo_Login,
        navigationOptions: {
            headerShown: false
        }
    },
    Weixin_Login: {
        screen: Weixin_Login
    },
    // 设置页面4+5
    Cachemanagement: {
        screen: Cachemanagement,
        navigationOptions: {
            headerShown: false
        }
    },
    Historyseting: {
        screen: Historyseting,
        navigationOptions: {
            headerShown: false
        }
    },
    Feedback: {
        screen: Feedback,
        navigationOptions: {
            headerShown: false
        }
    },
    Messagenotification: {
        screen: Messagenotification,
        navigationOptions: {
            headerShown: false
        }
    },
    Mycollection: {
        screen: Mycollection,
        navigationOptions: {
            headerShown: false
        }
    },
    Editordelete: {
        screen: Editordelete,
        navigationOptions: {
            headerShown: false
        }
    },
    Offlinecaching: {
        screen: Offlinecaching,
        navigationOptions: {
            headerShown: false
        }
    },
    Praise: {
        screen: Praise,
        navigationOptions: {
            headerShown: false
        }
    },
    MySeting: {
        screen: Seting,
        navigationOptions: {
            headerShown: false
        }
    },
    Shareapps: {
        screen: Shareapps,
        navigationOptions: {
            headerShown: false
        }
    },
// VideoPlay: {
//         screen: VideoPlay,
//         navigationOptions: {
//             headerShown: false
//         }
//     },
//     Barrage: {
//         screen: Barrage,
//         navigationOptions: {
//             headerShown: false
//         }
//     },
//     ShareButton: {
//         screen: ShareButton,
//         navigationOptions: {
//             headerShown: false
//         }
//     },
//     TestCustomAlert: {
//         screen: TestCustomAlert,
//         navigationOptions: {
//             headerShown: false
//         }
//     },
//     PlaySpeed: {
//         screen: PlaySpeed,
//         navigationOptions: {
//             headerShown: false
//         }

//     },
//     ChooseAShow: {
//         screen: ChooseAShow,
//         navigationOptions: {
//             headerShown: false
//         }
//     },
//     xuanji: {
//         screen: xuanji,
//         navigationOptions: {
//             headerShown: false
//         }
//     },
//     DownloadProgress: {
//         screen: DownloadProgress,
//         navigationOptions: {
//             headerShown: false
//         }
//     }
    Demo:{
        screen:Demo,
        navigationOptions:{
            headerShown:false
        }
    },
});

// 下面一概不会初级CV一枚
export const rootCom = "MainTab";

export const RootNavigator = createAppContainer(MainNavigation);

export const middleware = createReactNavigationReduxMiddleware(
    state => state.nav,
    'root'
);

const AppWithNavigationState = createReduxContainer(RootNavigator, 'root');

const mapStateToprops = state => ({
    state: state.nav
});

export default connect(mapStateToprops)(AppWithNavigationState);